<?php
class Controll
{
    var $mUrl;
    var $mSelfUrl;
    var $mScriptName;
    function __construct ()
    {
        $this->setUrl();
    }
    function controller ()
    {
        $urlPath = $this->getUrlPath();
        $path =  @array_shift($urlPath);
        if($path=='' || empty($path)){
            $path = './template/index';
        }else{
            $path = './template/'.$path;
        }
        return file_get_contents($path . '.html');
    }
    public function setUrl()
    {
        $this->mSelfUrl = $_SERVER['PHP_SELF'];
        $this->mScriptName = $_SERVER['SCRIPT_NAME'];
    }
    public function getUrlPath()
    {
        $urlInfo = str_replace($this->mScriptName,'',$this->mSelfUrl);
        $url = array();
        if($urlInfo)
        {
            $url = explode('/',$urlInfo);
            array_shift($url);
            return $url;
        }
    }
    function getHeader(){
        return file_get_contents('./template/header.html');
    }
    function getFlooter(){
        return file_get_contents('./template/flooter.html');
    }
}
?>